package test;

import java.util.Arrays;

/**
 * @author oldliu
 * @since 1.0
 */
public class DoubleRedBall {
    public static void main(String[] args) {
        int[] arr = new int[6];
        for (int i = 0; i < arr.length ; ) {
            arr[i] = (int) ((Math.random() * 33) + 1);
            //arr[i]当前值，判断当前值是不是和之前的有没有一样的！0 --i-1
            boolean repeat=false;
            for(int j=0;j<i;j++){
                if(arr[j]==arr[i]){
                    repeat=true;
                    break;
                }
            }
            if(!repeat)
                i++;
        }
        Arrays.sort(arr);
        System.out.println("6个红球");
        for(int k:arr){
            System.out.print(k+"\t");
        }
        int []ball=new int[7];
        //arr中的6个复制过来
        for (int i = 0; i <arr.length ; i++) {
            ball[i]=arr[i];
        }
        ball[ball.length-1]= (int) (Math.random()*16+1);
        System.out.println();
        for(int k:ball){
            System.out.print(k+"\t");
        }
    }
}
